/**
 * @file	mouse_controller.h
 * @author	Mitch, David
 * @brief
 */

#ifndef MOUSE_CONTROLLER_H_
#define MOUSE_CONTROLLER_H_

/**
 * @brief	LED initializaton function. Initialize ports PD4 to PD7 to use LEDs.
 */
void init_LED(void);

/**
 * @brief	Initialize radio.
 */
void init_radio(void);

/*
 * @brief Prepare roomba command packet.
 *
 * @param packet a packet to be sent to Roomba
 * @param command a command to be sent to Roomba
 * @param arguments arguments to be sent to Roomba,
 * 		  first 2 bytes: avg velocity (mm/s), second 2 bytes: radius (mm)
 * */
void set_roomba_command(radiopacket_t *packet, uint8_t command);

/**
 * @brief	Roomba Driving function. Parameters are velocity and radius.
 */
void roomba_Drive( int16_t velocity, int16_t radius ) ;

/**
 * @brief	Search for n ticks.
 */
void search_n_ticks(int n);

/**
 * @brief	Get bumper status. Return 0 if not activated, otherwise 1.
 */
int get_bumper_status();

/**
 * @brief	return max value between a and b.
 */
int max(int a, int b);

/**
 * @brief	Sample sensor 10 times to make sure north, east or west sensor is active.
 */
int is_sensor_north(void);

/**
 * @brief	Radio Send task.
 */
void radio_tx(void);

/**
 * @brief	Radio Receive task.
 */
void radio_receive_task(void);

/**
 * @brief	Control task function. Roomba randomly moves forward, backward, turn left or turn right.
 */
void control_task(void);

/**
 * @brief	Mouse Controller Main function. Instantiate system and BRR tasks.
 */
int main (void);

#endif /* MOUSE_CONTROLLER_H_ */
